package baseConfig

import (
	"time"
)

type AppConfig struct {
	JwtConfig        *JwtConfig        `mapstructure:"jwt"`
	MysqlConfig      *MysqlConfig      `mapstructure:"mysql"`
	RedisConfig      *RedisConfig      `mapstructure:"redis"`
	GRpcServerConfig *GRpcServerConfig `mapstructure:"grpc"`
	ServerConfig     *ServerConfig     `mapstructure:"server"`
	TracerConfig     *TracerConfig     `mapstructure:"tracer"`
	NacosConfig      *NacosConfig      `mapstructure:"nacos"`
}

type JwtConfig struct {
	Key        string        `mapstructure:"key"`
	Timeout    time.Duration `mapstructure:"timeout"`
	MaxRefresh time.Duration `mapstructure:"max-refresh"`
}

type MysqlConfig struct {
	Host                  string `mapstructure:"host"`
	Username              string `mapstructure:"username"`
	Password              string `mapstructure:"password"`
	Database              string `mapstructure:"database"`
	MaxIdleConnections    int    `mapstructure:"max-idle-connections"`
	MaxOpenConnections    int    `mapstructure:"max-open-connections"`
	MaxConnectionLifeTime int    `mapstructure:"max-connection-life-time"`
}

type RedisConfig struct {
	Addr     string `mapstructure:"addr"`
	Password string `mapstructure:"password"`
}

type GRpcServerConfig struct {
	Addr string `mapstructure:"addr"`
}

type ServerConfig struct {
	HttpConfig  *HttpConfig  `mapstructure:"http_config"`
	HttpsConfig *HttpsConfig `mapstructure:"https_config"`
}

type HttpConfig struct {
	Addr string `mapstructure:"addr"`
}

type HttpsConfig struct {
	Addr      string    `mapstructure:"addr"`
	TlsConfig TlsConfig `mapstructure:"tls"`
}

type TlsConfig struct {
	CertFile       string `mapstructure:"cert_file"`
	PrivateKeyFile string `mapstructure:"private_key_file"`
}

type TracerConfig struct {
	Url string `mapstructure:"url"`
}

type NacosConfig struct {
	Host string `mapstructure:"host"`
	Port uint64 `mapstructure:"port"`
}
